package com.example.codeger.string;

import cn.hutool.extra.template.Template;
import cn.hutool.extra.template.TemplateEngine;
import com.example.config.BeetlIntegrationExample;
import lombok.Builder;
import lombok.Data;

import java.util.Map;

@Builder
@Data
public class StringSourseBuilder {
    //模板字符串
    private String templateContent;
    //数据
    private Map<String, Object> data;


    public String handler() {
        //获取模板引擎
        TemplateEngine engine = BeetlIntegrationExample.getTemplateEngine();

        // 获取模板
        Template template = engine.getTemplate(this.templateContent);
        // 渲染模板
        return template.render(this.data);

    }

}
